package zy.blue7.im;

import zy.blue7.im.common.message.GroupMessage;
import zy.blue7.im.common.message.SingleMessage;
import zy.blue7.im.common.message.response.Result;
import zy.blue7.im.handler.ClientMessageHandler;
import zy.blue7.im.handler.ResultMessageHandler;
import zy.blue7.im.handler.impl.GroupMessageHandlerImpl;
import zy.blue7.im.handler.impl.LoginResponseHandlerImpl;
import zy.blue7.im.handler.impl.ResultMessageHandlerImpl;
import zy.blue7.im.handler.impl.SingleMessageHandlerImpl;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author blue7
 * @version 1.0
 * @date 2022/3/4 9:36
 */
public class ClientContainer {

    public static Map<String, ResultMessageHandler> resultHandlerMap = new ConcurrentHashMap<>();
    public static Map<Class, ClientMessageHandler> handlerMap = new ConcurrentHashMap<>();
    /**
     * 保存登录状态
     */
    public static Map<Object, String> sessionMap = new ConcurrentHashMap<>();


    static {
        handlerMap.put(Result.class, new ResultMessageHandlerImpl());
        handlerMap.put(SingleMessage.class, new SingleMessageHandlerImpl());
        handlerMap.put(GroupMessage.class, new GroupMessageHandlerImpl());
        resultHandlerMap.put("200", new LoginResponseHandlerImpl());
    }
}
